
#if Windows

#include "variant_thread.h"

#else

#include "variant_thread.h"

#include <pthread.h>

//using namespace std;
//using namespace std::chrono;

int std::chrono::milliseconds( int millisec )
{
	return millisec;
}

void* std::_thread_run(void* dataPtr)
{
	std::_data* data = static_cast<std::_data*>(dataPtr);
	(data->_thread->*data->_method)(data->_arguments);
	
	delete dataPtr;
	dataPtr = 0; // Null.

	return 0; // Null.
}

void std::this_thread::sleep_for(int milliseconds)
{
	struct timespec ts;
    ts.tv_sec   = milliseconds / 1000;
    ts.tv_nsec  = (milliseconds % 1000) * 1000000;
    //while(-1 == ::nanosleep(&ts, &ts))
	//{
    //    /* nop */
    //}
	::nanosleep(&ts, &ts);
}

#endif